---@class BuffEffect255100 : BaseBuffEffect
BuffEffect255100 = ClientFight.CreateClass("BuffEffect255100", ClientFight.BaseBuffEffect)
local t = BuffEffect255100

function t:add(fight, buff)
    local size = t:getSize(fight, buff);
    t:addAttri(buff, size);
    SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s每个近战增加属性buff %s 人数:%s",
            fight.frame, buff.target.fighterId, buff.modelId, size
    ));
    return ClientFight.BaseBuffEffect.add(self, fight, buff);
end

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    t:addAttri(buff, size);
    SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s每个近战增加属性buff %s 人数:%s",
            fight.frame, buff.target.fighterId, buff.modelId, size
    ));
    ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
    return IBuffEffect.SUCCESS_ATTRI_HAS_CHANGE;
end

function t:addAttri(buff, size)
    buff.attributes.attributes = {};
    local buffEffectValue = buff.buffBean.f_BuffEffectValue;
    for i = 1, table.getn(buffEffectValue), 2 do
        buff.attributes.attributes[buffEffectValue[i]] = size * buffEffectValue[i + 1];
    end
end

function t:add(fight, buff)
    local size = t:getSize(fight, buff);
    t:addAttri(buff, size);
    SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s每个近战增加属性buff %s 人数:%s",
            fight.frame, buff.target.fighterId, buff.modelId, size
    ));
    return ClientFight.BaseBuffEffect.add(self, fight, buff);
end

function t:getSize(fight, buff)
    local size = 0;
    local team = buff.target.fightTeam;
    for k, fighter in pairs(team.fighters) do
        if (fighter:isDie()) then
            goto continue;
        end
        if (fighter:isSummons()) then
            goto continue;
        end
        if (fighter.isRangedCLass()) then
            goto continue;
        end
        size = size + 1;
        :: continue ::
    end
    return size;
end

t.New()